
<html>

<head>
    <include file="public@head" title="添加栏目"/>
</head>

<body class="layui-layout-admin">
<include file="public@header"/>
<include file="public@side"/>
<div class="layui-body">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a href="{:url('tdadmin/index/index')}">主页</a>
        <a>内容管理</a>
        <a href="{:url('index')}?college_id={$_GET['college_id']}"><cite>专业管理</cite></a>
    </div>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-header">
                专业学院
            </div>
            <div class="layui-card-body layui-row">
                <form method="post" class="layui-form layui-col-md6" action="{:url('add')}">
                    <div class="layui-form-item">
                        <label class="layui-form-label">专业名称<span class="form-required">*</span></label>
                        <div class="layui-input-block">
                            <input type="text" id="name" class="layui-input" name="specialty_name" placeholder="请输入专业名称">
                            <input type="hidden"  class="layui-input" name="college_id" value="{$_GET['college_id']}">
                        </div>
                    </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="layui-btn" lay-submit lay-filter="general">添加</button>
                                    <a class="layui-btn layui-btn-primary" href="javascript:history.back(-1);">返回</a>
                                </div>
                            </div>
                </form>
            </div>
        </div>
    </div>
</div>
<include file="public@scripts"/>
<script>
    $('#name').blur(function () {
        var name = $(this).val();
        $.post("{:url('college/checkName')}", {'name': name}, function (res) {
            if (res.code == 1) {
                layer.msg(res.msg, {icon: 1}, function () {
                    return false;
                });
            } else {
                layer.msg(res.msg, {icon: 2}, function () {
                    return false;
                });
            }
        });
    });
</script>
</body>

</html>
